import math
import unittest
import numpy as np
from check import get_rotate_matrix_from
from check import process_path

class TestRotate(unittest.TestCase):
    def test_rotate_matrix(self):
        input_value = [(1, 1), (-1, 1), (-1, -1), (1, -1)] 
        theta = [225, 135, 45, 315]
        for i, item in enumerate(input_value):
            result = get_rotate_matrix_from(*item)  # Fix: Close the parentheses
            cos_theta = math.cos(math.radians(theta[i]))
            sin_theta = math.sin(math.radians(theta[i]))
            expect = np.array([[cos_theta, -sin_theta], [sin_theta, cos_theta]])
            np.testing.assert_allclose(result, expect, rtol=1e-5, atol=0)

    def test_process_path(self):
        path = []
        for i in range(50):
            path.append(np.array([i, -i]))
        result = process_path(np.array(path))
        self.assertAlmostEqual(7.07106781, result[3])


if __name__ == '__main__':
    unittest.main()